<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>单位管理员首页</title>
<link rel="stylesheet" href="<%=path%>/css/bootstrap.min.css" />
<link rel="stylesheet" href="<%=path%>/css/easyui.css" />
<link rel="stylesheet" href="<%=path%>/css/icon.css" />
<style>
body {
	background-color: #f1f1f1;
}

.lightBg {
	background-color: #fff;
	padding: 5px 20px;
}
</style>
</head>
<body>
	<div class="container">
		<div class="row lightBg">
			<!--标题-->
			<h2 class="pull-left">
				<%-- <img src="<%=path%>/images/logo.png" style="width: 80px;">
				智游科技项目申报系统 --%>
			</h2>
			<p class="pull-right" style="margin-top: 20px;">
			<!-- 	欢迎您，单位管理员123&nbsp;|&nbsp;<a href="">站内消息(2)</a>&nbsp;<a
					href="index.jsp">退出</a> -->
			</p>
		</div>
		<div class="row" style="margin-top: 20px;">
			<!--页面一二级菜单部分，公用的-->
			
		</div>

		<!--页面实际数据管理部分-->
		<div class="row" style="margin-top: 20px;">
			<div style="background-color: #fff;padding: 20px;">
				<input type="text"  id="pname" placeholder="项目名称"  /> <input type="text"
					id="ptype" placeholder="项目类型"  /> 填报时间：<input type="date" id="ptime"
					value="" /> </select>
				<button id="seachpro" class="btn btn-primary">查询</button>
			</div>
			<div style="background-color: #fff;padding: 20px;">
				<table id="dg" class="easyui-datagrid" title="数据表格示例"
					style="height: 500px;"
					data-options="rownumbers:true,singleSelect:true,url:'getAllpr',method:'post'
					,pagination : true,pageSize : 5,pageList : [ 5, 10, 15 ],fitColumns : true,striped : true"
					toolbar="#tb">
					<thead>
						<tr>
							<th data-options="field:'ck',checkbox:true"></th>
							<th data-options="field:'pid'">项目编号</th>
							<th data-options="field:'pname'" formatter="xiangmu">项目名称</th>
							<th data-options="field:'ptype',align:'right'">项目类型</th>
							<th width="90px" formatter="format"
								data-options="field:'company',align:'center'" title="申报单位">申报单位</th>
							<th data-options="field:'pcontact'">负责人</th>
							<th data-options="field:'pcompany',align:'center'">推荐单位</th>
							<th data-options="field:'ptime',align:'center'">填报时间</th>
							<th data-options="field:'pstate',align:'center'" formatter="zt">发布状态</th>
							<th data-options="field:'d',width:110,formatter:cp">产品</th>
							<th data-options="field:'i',width:110,formatter:pdf">导出pdf</th>
						</tr>
					</thead>
				</table>
				<div id="tb" style="padding:5px;height:auto">
					<div style="margin-bottom:5px">
						<!-- <a href="#" class="easyui-linkbutton" iconCls="icon-add"
							plain="true">添加</a> <a href="#" class="easyui-linkbutton"
							iconCls="icon-edit" plain="true">编辑</a> <a href="#"
							class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a> -->
					</div>
					<div></div>
				</div>


			</div>


			<script src="<%=path%>/js/jquery1.12.4.min.js"></script>
			<script src="<%=path%>/js/bootstrap.min.js"></script>
			<script src="<%=path%>/js/jquery.easyui.min.js"></script>
			<script type="text/javascript">
			//value获得这个单元格的属性,row获得这一行的对象,index获得下标
			//根据项目名称查询项目详细信息
			   function xiangmu(value,row,index){
			   
			   return "<a href='javascript:getProject("+row.pid+")'>"+value+"</a>";
			   };
			   function getProject(PId){
			 
			  window.location.href = "ject?PId="+PId;
			   }
			   
			 //根据身申报单位查询单位详细信息
			   function format(value,row,index) {
				
			   return "<a href='javascript:getByName("+row.company.cid+")'>"+value.cname+"</a>";
				};
			    
			   function getByName(cid){
			   alert(cid);
			   window.location.href="ByName?CId="+cid;
			   }
			  
			   
			   //导出pdf
			   function pdf(value,row,index){
			    return "<a href='javascript:pdfs("+row.pid+")'>导出pdf</a>";
			   }
			   function pdfs(PId){
			   
			   if(window.confirm('你确定要导出吗？')){
			   alert("您的pdf将导出到D盘!");
			   window.location.href="pdf?PId="+PId;
			   }else{
			   window.location.href="a";
			   }
			   }
			   
			   //查看此项目下的产品
			   function cp(value,row,index){
			   return "<a href='javascript:cps("+row.pid+")'>查看产品</a>";
			   }
			   function cps(PId){
			   alert(PId);
			   window.location.href="propp?PId="+PId;
			   }
			   
			   
				function goBack(bid) {
					alert(bid);
				}
				function zt(value){
				if(value==0){
				return "未审核";
				}else if(value==1){
				return "一级审核";
				}else if(value==2){
				return "二级审核";
				}
				}
				
				//模糊查询
				$(function() {
					$("#seachpro").button().click(function() {
						searchProject();
					});
					$("#dg").datagrid()({
						url : 'getAllProject'
					});
				});
				function searchProject() {
					var pname = $('#pname').val();
					var ptime = $('#ptime').val();
					var ptype = $('#ptype').val();
					$('#dg').datagrid('load', {
						PName : pname,
						PTime : ptime,
						PType : ptype
					});
				}
				
				
				
				
				
				$(function() {

					var toolbar = [ {
						text : 'Add',
						iconCls : 'icon-add',
						handler : function() {
							alert('add')
						}
					}, {
						text : 'Cut',
						iconCls : 'icon-cut',
						handler : function() {
							alert('cut')
						}
					}, '-', {
						text : 'Save',
						iconCls : 'icon-save',
						handler : function() {
							alert('save')
						}
					} ];

					$('.easyui-tabs').tabs('select', '系统管理');

					$('#dg').datagrid().datagrid({
						pagination : true, //如果为true，则在DataGrid控件底部显示分页工具栏。
						fitColumns : false,
					});
				})
			</script>
</body>
</html>